Show Code
import pandas as pd
import plotly.express as px

📈 Global Trend of Moderate Food Poverty Over Time

Storyline: This time-series chart illustrates the global average of moderate food poverty over the past years. It helps visualize how food insecurity has evolved globally, revealing patterns, progress, and setbacks linked to socioeconomic disruptions, conflict, climate change, and global health crises.

Show Code
indicator = pd.read_excel("unicef_indicator_2.xlsx")
df = indicator[['country', 'time_period', 'obs_value', 'sex', 'indicator']].copy()
df = df[df['sex'] == 'Total']
df.dropna(subset=['obs_value'], inplace=True)
df['time_period'] = pd.to_numeric(df['time_period'], errors='coerce')

ts_df = df.groupby("time_period", as_index=False)["obs_value"].mean()

fig1 = px.line(ts_df, x="time_period", y="obs_value",
               title="Global Trend of Moderate Food Poverty Over Time",
               labels={"obs_value": "%"})
fig1.show()

📊 Top 10 Countries – Moderate Food Poverty

Storyline: This horizontal bar chart highlights the top 10 countries with the highest levels of moderate food poverty in the most recent year available. It helps decision-makers quickly identify the most affected areas that require urgent attention and targeted intervention.

Show Code
latest_year = df['time_period'].max()
bar_df = df[df['time_period'] == latest_year]
top10 = bar_df.groupby("country", as_index=False)['obs_value'].mean().nlargest(10, 'obs_value')

fig2 = px.bar(top10, x="obs_value", y="country", orientation='h',
              title=f"Top 10 Countries – Moderate Food Poverty ({latest_year})",
              labels={"obs_value": "%", "country": "Country"})
fig2.show()

📉 Gender Disparities – Male vs Female

Storyline: This scatter plot compares moderate food poverty between males and females in different countries for the most recent year. Countries above the diagonal line indicate higher food poverty among females, revealing gender inequality in access to food and nutrition.

Show Code
sex_df = indicator[indicator['time_period'] == latest_year]
pivot = sex_df.pivot_table(index='country', columns='sex', values='obs_value').dropna().reset_index()

fig3 = px.scatter(pivot, x="Male", y="Female", hover_name="country",
                  trendline="ols",
                  title=f"Male vs Female Food Poverty ({latest_year})",
                  labels={"Male": "Male (%)", "Female": "Female (%)"})
fig3.show()

🌍 World Map – Country-Level Food Poverty Rates

Storyline: This choropleth map offers a global view of food poverty distribution for the most recent year. The geographic patterns help policymakers and humanitarian organizations quickly identify regions with higher prevalence and direct aid where it is needed most.

Show Code
map_df = df[df['time_period'] == latest_year]
avg_map = map_df.groupby("country", as_index=False)['obs_value'].mean()

fig4 = px.choropleth(avg_map, locations="country", locationmode="country names",
                     color="obs_value", hover_name="country",
                     title=f"World Map: Food Poverty Rates ({latest_year})",
                     color_continuous_scale="YlOrRd",
                     labels={"obs_value": "%"})
fig4.show()